#ifndef __IO_H_
#define __IO_H_

static inline uint8_t readb(const volatile void *addr)
{
	return *((const volatile uint8_t*)addr);
}

static inline uint16_t readw(const volatile void *addr)
{
	return *((const volatile uint16_t*)addr);
}

static inline uint32_t readl(const volatile void  *addr)
{
	return *((const volatile uint32_t*)addr);
}

static inline void writeb(unsigned char b, volatile void *addr)
{
	*((volatile unsigned char*)addr) = b;
}

static inline void writew(unsigned short b, volatile void *addr)
{
	*((volatile unsigned short*)addr) = b;
}

static inline void writel(unsigned int b, volatile void *addr)
{
	*((volatile unsigned int*)addr) = b;
}

static inline void udelay(unsigned long loops)
{	
    __asm__ volatile ("1:\n" "subs %0, %1, #1\n" "bne 1b":"=r" (loops):"0"(loops));
}


#endif

/*********************************************************************************************************
  END FILE
*********************************************************************************************************/

